<?php


namespace app\api\service;


class Product
{
    private $product =null;

    public function __construct()
    {
        $this->product = new \app\api\model\Product();
    }

    public function dataIlist($data,$page,$limit){
        if(!null==$data)
            return  $this->product->where($data)->page($page)->limit($limit)->select()->toArray();
        else
            return $this->product->page($page)->limit($limit)->select()->toArray();
    }

    public function dataIlistAllCount($data){
        if(!null==$data)
            return  $this->product->where($data)->count();
        else
            return $this->product->count();
    }
    public function dataIlistCount($data,$page,$limit){
        if(!null==$data)
            return  $this->product->where($data)->page($page)->limit($limit)->count();
        else
            return $this->product->page($page)->limit($limit)->count();
    }
}